package atguigu.nio.buffer;

import java.io.*;

public class BufferDemo2 {

    public static void main(String[] args) {
        try {
            Reader r = new FileReader("d://data.txt");
            BufferedReader br = new BufferedReader(r);//由于是子类独有的功能，所有不能使用多态创建
            String s;
            byte []buffer = new byte[1024];
            while ((s = br.readLine())!=null){
                System.out.println(s);
            }

            // 正常情况下会将文件中的数据依次输出；
//            Reader r = new FileReader("File//data.txt");
//            BufferedReader br = new BufferedReader(r);
//            br.readLine();
//            br.readLine();
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
